home *** CD-ROM | disk | FTP | other *** search
/ MacHack 2000 / MacHack 2000.toast / pc / The Hacks / IPFlakeWay / Squelch Module / source / NatEmbedded.h < prev    next >
Text File  |  2000-06-23  |  2KB  |  55 lines

  1. // =================================================================================
  2. //    NatEmbedded.h                     ©1998 Sustainable Softworks. All rights reserved.
  3. // =================================================================================
  4. //    Network Address Translation for Embedded Data
  5. //    This module translates the data portion of IP datagrams
  6. //    (technically a layering violation)
  7. //
  8. //    Since we must operate in the STREAMS context, this module is written
  9. //    in traditional C (not C++).
  10.  
  11. #ifndef _H_NatEmbedded
  12. #define _H_NatEmbedded
  13. #pragma once
  14.  
  15. // ---------------------------------------------------------------------------
  16. //        • FindByte
  17. // ---------------------------------------------------------------------------
  18. //    Find Byte in data block (match upper or lower case)
  19. //    Input: data block, first byte offset, last byte offset, byte to look for
  20. //    Output: offset of byte or Zero if not found
  21. UInt16
  22. FindByte(UInt8* data, UInt16 inFirst, UInt16 inLast, UInt8 inByte);
  23.  
  24. // support functions
  25. Boolean        IsDigit(UInt8 inDigit);
  26. UInt8        GetOctet(UInt8* inStr, UInt16 inSize, UInt8* ioPos, OSStatus* outErr);
  27. void        PutOctet(UInt8 inOctet, UInt8* ioPos, char* outStr);
  28.  
  29.  
  30. // ---------------------------------------------------------------------------
  31. //        • itoc
  32. // ---------------------------------------------------------------------------
  33. //    Convert integer to character string and return length of string.
  34. //    May be called at interrupt time (unlike NumToString).
  35. //    Leave unterminated so we can append digits in place.
  36. //
  37. //    A 32-bit integer can produce 10 decimal digits plus a sign and null byte
  38. //    so outStr should be at least 12 characters long.
  39. UInt8
  40. itoc(SInt32 inNum, char* outStr);
  41.  
  42.  
  43. // ---------------------------------------------------------------------------
  44. //        • ctoi
  45. // ---------------------------------------------------------------------------
  46. //    Convert sequence of decimal digits to an integer
  47. //    Stop at first non-digit character and return number of characters converted.
  48. //    A 32-bit int can hold a 10 digit decimal, so convert up to 10 characters max.
  49. UInt8
  50. ctoi(char* inStr, SInt32* outNum);
  51.  
  52. #define kFtpControlPort 21
  53. #define kFtpDataPort 20
  54.  
  55. #endif